import javax.media.j3d.Appearance;
import javax.media.j3d.Material;
import javax.media.j3d.Shape3D;
import javax.vecmath.AxisAngle4d;
import javax.vecmath.Color3f;
import javax.vecmath.Matrix4f;
import javax.vecmath.Point3f;

import com.sun.j3d.utils.geometry.GeometryInfo;
import com.sun.j3d.utils.geometry.NormalGenerator;

/** Tegner opp en kube som helixen er satt inni.
 * 
 * @author Alexander Vrtis, Andreas Leknes, Steffan Sørenes
 *
 */
public class HelixContainer extends Shape3D {

	public HelixContainer(float w) {
		Point3f[] box = {

				new Point3f(-w, -w, w),
				new Point3f(w, -w, w),
				new Point3f(w, -w, -w),
				new Point3f(-w, -w, -w),

				new Point3f(-w, w, -w),
				new Point3f(w, w, -w),
				new Point3f(w, w, w),
				new Point3f(-w, w, w),

				new Point3f(w, w, w), 
				new Point3f(w, w, -w),
				new Point3f(w, -w, -w), 
				new Point3f(w, -w, w),

				new Point3f(-w, -w, w),
				new Point3f(-w, -w, -w),
				new Point3f(-w, w, -w),
				new Point3f(-w, w, w),

				new Point3f(-w, -w, -w), 
				new Point3f(w, -w, -w),
				new Point3f(w, w, -w),
				new Point3f(-w, w, -w) };

		Color3f[] colors = new Color3f[20];
		for (int i = 0; i < colors.length; i++) {
			colors[i] = new Color3f(0.7f, 0.7f, 0.7f);
		}

		GeometryInfo gi = new GeometryInfo(GeometryInfo.QUAD_ARRAY);

		gi.setCoordinates(box);
		gi.setColors(colors);

		NormalGenerator ng = new NormalGenerator();
		ng.generateNormals(gi);

		Appearance ap = new Appearance();
		ap.setMaterial(new Material());

		this.addGeometry(gi.getGeometryArray());
		this.setAppearance(ap);
	}

}
